package com.aqie.factory.model.api;

import java.util.Date;

@SuppressWarnings({"WeakerAccess", "unused"})
public class RspModel<T> {
    public static final int SUCCEED = 1;

    public static final int ERROR_UNKNOWN = 0;

    private int code;
    private String message;

    private Date time;
    private T result;
    private Boolean succeed;

    public boolean success() {
        return code == SUCCEED;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getResult() {
        return result;
    }

    public Boolean getSucceed() {
        return succeed;
    }

    public void setSucceed(Boolean succeed) {
        this.succeed = succeed;
    }

    public void setResult(T result) {
        this.result = result;
    }

    // 通用异常
    public static final int SERVER_ERROR = 500100;
    public static final int PARAMETER_ERROR = 500101;
    public static final int REQUEST_ILLEGAL = 500102;
    public static final int ACCESS_LIMIT_REACHED = 500103;
    public static final int SMS_SERVER_ERROR = 500104;

    // 用户模块
    public static final int USER_NAME_NOT_FOUND_ERROR = 500200;
    public static final int USER_MOBILE_NOT_FOUND_ERROR = 500201;
    public static final int USER_NOT_LOGIN_ERROR = 500202;
    public static final int USER_NAME_EXIST_ERROR = 500203;
    public static final int USER_MOBILE_EXIT_ERROR = 500204;
    public static final int USER_NAME_OR_PASSWORD_ERROR = 500205;
    public static final int SESSION_ERROR = 500210;
    public static final int TOKEN_INVALID_ERROR = 500211;

    // 群消息
    public static final int GROUP_NOT_FOUND_ERROR = 500211;
    public static final int GROUP_MEMBER_NOT_FOUND_ERROR = 500211;

    // 数据库
    public static final int DATABASE_ERROR = 500400;
    public static final int ACCOUNT_REGISTER_ERROR = 500411;
    public static final int BIND_PUSH_ID_ERROR = 500412;
    public static final int USER_UPDATE_ERROR = 500413;
    public static final int GROUP_CREATE_ERROR = 500414;
    public static final int MESSAGE_CREATE_ERROR = 500415;

}
